/*网盘——客户端*/
#include "client.h"

int main(void)
{
	char buf[50];//命令字符串

	/*初始化服务端socket地址*/
	struct sockaddr_in server;
	server.sin_family = AF_INET;
	server.sin_addr.s_addr = inet_addr("192.168.104.99");
	server.sin_port = htons(12001);	

	/*循环读取键盘输入的命令*/
	while (1) 
	{
		printf("ftp>");
		bzero(buf, 50);
		fgets(buf, 50, stdin); 

		//根据命令内容调用函数，每发一次命令打一次电话
		if(strncmp(buf,"help",4) == 0)
			help();
		else if(strncmp(buf,"ls",2) == 0)
			ls(server);
		else if(strncmp(buf,"get",3) == 0)
			get(server,buf);
		else if(strncmp(buf,"put",3) == 0)
			put(server,buf);
		else if(strncmp(buf,"quit",4) == 0)
			return 0;
		else
			printf("输入命令有误，请重新输入。\n");
	}

	return 0;
}

